package com.lijin.study.java.exception;

import org.junit.Test;


public class ExceptionTest {

	@Test
	public void test() {
//		System.out.println("-----------Test------------");
//		
//		boolean c = false;
//		
//		try {
//			System.out.println("Test try 1");
//		} finally {
//			System.out.println("Test finally 1");
//		}
//		
//		try {
//			System.out.println("Test try 2");
////			c = true;
//			if (c) {
//				throw new RuntimeException("Ex2");
//			}
//		} finally {
//			System.out.println("Test finally 2");
//		}
//		
//		try {
//			System.out.println("Test try 3");
//		} finally {
//			System.out.println("Test finally 3");
//		}
		
		for (int i = 0; i < 10; i ++) {
			try {
				if (i == 2) {
					throw new IllegalStateException("错误码" + i);
				}
			} catch (Exception e) {
				System.out.println(e.getMessage());
				continue;
			}
			System.out.println(i);
		}
	}
	
}
